package com.xxl.job.executor.service.jobhandler;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.executor.annotation.CronJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class TestXxlJob<zs> {
    private static Logger logger = LoggerFactory.getLogger(TestXxlJob.class);

    private static final String JOB_ID = "JOB00001";// 定时任务编号
    
    @CronJob(jobId = JOB_ID)
    @XxlJob("test1JobHandler")
    public ReturnT<String> test1JobHandler() throws Exception {
        String runDateStr = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date());
        logger.info("定时任务执行时间:{}", runDateStr);
        XxlJobHelper.log("XXL-JOB-test1JobHandler-JOB00001, Hello World");
        return ReturnT.SUCCESS;
    }

}
